<template>
	<view>

		<view class="top">
			<!--  -->
		</view>

<!-- 		<uni-card :is-shadow="false" style="border-radius: 30rpx; position: relative; top: -100rpx;">
			<view style="display:flex;  justify-content: space-between;width: 90% ;align-items: center;">


				<view>
					<image src="../../../static/7fd1b81f3c559caabc335ad7ef2ef2f.png"
						style="width: 120rpx; height: 120rpx;"></image>
				</view>


				<view style="margin-right: 200rpx;">
					<view>车型:{{chexing}}</view>
					<view>车牌:{{chepai}}</view>
				</view>

				<view @click="me" style="margin-right: -50rpx;">
					<image v-if="a == 1" src="../../../static/tyuotun.png" style="width: 50rpx; height: 50rpx;"></image>

					<image v-if="a == 0" src="../../../static/zuwukaobei.png" style="width: 50rpx; height: 50rpx;">
					</image>
				</view>


			</view>




		</uni-card> -->
		
		
		<uni-card  v-for="(item,index) in chelist"  :index="index"  :key="index"     :is-shadow="false" style="border-radius: 30rpx; position: relative; top: -100rpx; ">
			<view style="display:flex;  justify-content: space-between;width: 90% ;align-items: center;">
		
		
				<view>
					<image :src="item.photo"
						style="width: 120rpx; height: 120rpx;"></image>
				</view>
		
		
				<view style="margin-right: 200rpx;">
					<view>车型:{{item.carModel}}</view>
					<view>车牌:{{item.carNumber}}</view>
				</view>
		
				<view @click="me" style="margin-right: -50rpx;">
					<image v-if="a == 1" src="../../../static/tyuotun.png" style="width: 50rpx; height: 50rpx;"></image>
		
					<image v-if="a == 0" src="../../../static/zuwukaobei.png" style="width: 50rpx; height: 50rpx;">
					</image>
				</view>
		
		
			</view>
	
		</uni-card>



<view style="width: 100%; height: 200rpx; background-color: white; position: relative; bottom: -350rpx;  display: flex; align-items: center;justify-content: center;">
	
	<view style="background: linear-gradient(to top right, white, blue); width: 90%; height: 70rpx; background-repeat: repeat;  border-radius: 30rpx; display: flex; justify-content: center; align-items: center;"> 

		
		<image style="width: 40rpx; height: 40rpx;"  src="../../../static/加号@3x.png"></image>
		
		
		<navigator url="/pages/shihao/add-vehicle/add-vehicle" style="margin-left: 20rpx;" >添加车辆</navigator>
		
		
	</view>
	
	     </view>
	


	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				
				chelist:'',
				a: 0,
				chexing: 'aaa',
				chepai: '保时捷'


			}
		},
		
		onLoad() {
			console.log("ppppppppppp")
			this.getcarlist()
		},
		methods: {
				getCookie(name) {
						    const nameEQ = name + "=";
						    const cookies = document.cookie.split(';');
						    for (let i = 0; i < cookies.length; i++) {
						        let c = cookies[i].trim();
						        if (c.indexOf(nameEQ) === 0) {
						            return decodeURIComponent(c.substring(nameEQ.length));
						        }
						    }
						    return null;
						},
			
			
			
			
			getcarlist(){
				let that=this
				const useris=that.getCookie("userid")
				this.$http({
					url:'api/user/userr/getcar/'+useris,
					method:"get",
					success(res){
						that.chelist=res.data.data
						console.log(that.chelist)
						console.log(res)
						
						
					}
					
					
					
				})
				
			},
			
			
			
			
			
			me(){
				console.log(this.a)
				if(this.a==0){
					this.a=1
				}else{
					this.a=0
				}
				
				console.log(this.a)
			}
			

		}
	}
</script>

<style>
	.top {
		width: 100%;
		height: 270rpx;
		background-color: #2f81fa;
	}
</style>